package QL;

import java.util.List;
import java.util.ArrayList;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class ButlerExcelGetListResponse extends BaseQLResponse
{
    /// <summary>
    /// 阿里云oss区域Url地址
    /// </summary>
    public String OssUrl;

    /// <summary>
    /// 文件列表
    /// </summary>
    public List<ButlerExcelItem> ExcelList;

    @Override
    public void DeserializeFromJson(JSONObject jsonObj)
    {
        JSONObject t = jsonObj.getJSONObject("error_response");
        if (t != null && !t.isNullObject())
        {
            ErrCode = t.getString("code");
            ErrMsg = t.getString("msg");
        }
        else
        {
            t = jsonObj.getJSONObject("butler_excel_get_list_response");
            if (t.has("oss_url"))
                OssUrl = t.getString("oss_url");
            ExcelList = new ArrayList<ButlerExcelItem>();
            JSONArray arrExcelList = t.getJSONObject("excel_list").getJSONArray("butler_excel_item");
            for (int i = 0; i < arrExcelList.size(); ++i)
            {
                ButlerExcelItem o = new ButlerExcelItem();
                o.DeserializeFromJson(arrExcelList.getJSONObject(i));
                ExcelList.add(o);
            }
        }
    }
}
